package com.ruoyi.project.system.controller;

import java.util.List;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.system.domain.SysDynamicParise;
import com.ruoyi.project.system.service.ISysDynamicPariseService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 动态点赞Controller
 * 
 * @author jjp
 * @date 2020-07-15
 */
@RestController
@Api("动态点赞")
@RequestMapping("/system/dynamicParise")
public class SysDynamicPariseController extends BaseController
{
    @Autowired
    private ISysDynamicPariseService sysDynamicPariseService;

    /**
     * 查询动态点赞列表
     */
    @PreAuthorize("@ss.hasPermi('system:parise:list')")
    @ApiOperation("查询动态点赞列表")
    @GetMapping("/list")
    public TableDataInfo list(SysDynamicParise sysDynamicParise)
    {
        startPage();
        List<SysDynamicParise> list = sysDynamicPariseService.selectSysDynamicPariseList(sysDynamicParise);
        return getDataTable(list);
    }

    /**
     * 获取动态点赞详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:parise:query')")
    @ApiOperation("获取动态点赞详细信息")
    @GetMapping(value = "/{pariseId}")
    public AjaxResult getInfo(@PathVariable("pariseId") Long pariseId)
    {
        return AjaxResult.success(sysDynamicPariseService.selectSysDynamicPariseById(pariseId));
    }

    /**
     * 新增动态点赞
     */
    @PreAuthorize("@ss.hasPermi('system:parise:add')")
    @ApiOperation("新增动态点赞")
    @Log(title = "动态点赞", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysDynamicParise sysDynamicParise)
    {
        return toAjax(sysDynamicPariseService.insertSysDynamicParise(sysDynamicParise));
    }

    /**
     * 修改动态点赞
     */
    @PreAuthorize("@ss.hasPermi('system:parise:edit')")
    @ApiOperation("修改动态点赞")
    @Log(title = "动态点赞", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysDynamicParise sysDynamicParise)
    {
        return toAjax(sysDynamicPariseService.updateSysDynamicParise(sysDynamicParise));
    }

    /**
     * 删除动态点赞
     */
    @PreAuthorize("@ss.hasPermi('system:parise:remove')")
    @ApiOperation("删除动态点赞")
    @Log(title = "动态点赞", businessType = BusinessType.DELETE)
	@DeleteMapping("/{pariseIds}")
    public AjaxResult remove(@PathVariable Long[] pariseIds)
    {
        return toAjax(sysDynamicPariseService.deleteSysDynamicPariseByIds(pariseIds));
    }
}
